package com.ldp.designpatterns.study.decorator.decorator;

import com.ldp.designpatterns.study.decorator.component.Coffee;

/**
 * @ClassName CoffeeDecorator
 * @Description 装饰模式_
 * TODO: 3:装饰器（Decorator）持有一个指向组件对象的引用，并实现了组件的接口。它可以包含额外的功能，也可以将请求传递给组件对象
 * @Author lindipei
 * @Date 2023/10/17 14:33
 */
//TODO: 创建装饰器抽象类
 public abstract class CoffeeDecorator implements Coffee {
    protected Coffee decoratedCoffee;
    public CoffeeDecorator(Coffee coffee){
        this.decoratedCoffee = coffee;
    }
    @Override
    public double cost() {
        return decoratedCoffee.cost();
    }

    @Override
    public String description() {
        return decoratedCoffee.description();
    }
}
